<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" type="text/css" href="${contextPath}/admin/stylesheets/common.css?v=${sversion}" media="screen" />
	<link rel="stylesheet" type="text/css" href="${contextPath}/admin/stylesheets/table.css?v=${sversion}" media="screen" />
	<script type="text/javascript" src="${contextPath}/ext/jquery/jquery-1.8.1.min.js"></script>
	<script type="text/javascript" src="${contextPath}/ext/jquery_form/jquery.form.min.js"></script>
	<script type="text/javascript" src="${contextPath}/ext/layer/layer.min.js"></script>
	<script type="text/javascript" src="${contextPath}/ext/laydate/laydate.js"></script>
	 
	
	<script type="text/javascript" src="${contextPath}/admin/ext/jquery/selectbox.js"></script>
	<script type="text/javascript" src="${contextPath}/admin/ext/zw/check.js?v=${sversion}"></script>
	<script type="text/javascript" src="${contextPath}/admin/javascripts/zcommon.js?v=${sversion}" basepath="${contextPath}" baseinit="ajaxCheckLogin"></script>

</head>
<body>
<div class="place">
    <span class="label-span">位置：</span>
    <ul id="place-list" class="place-ul">
        <li>任务配置</li>
    </ul>
</div>
<div class="body-warp">
    <div class="panel">
        <div class="panel-title">
            <i class="form-icon"></i>
            <span class="title-text">基本信息</span>
        </div>
        <div class="panel-body">
		    <form id="saveform" method="post">
		    	<input type="hidden" name="id" value="${(obj.id)!}"/>
		        <table class="form-table">
		        	<tr>
                        <td><label class="form-label">任务名称<b class="red">*</b></label></td>
                        <td>
                            <input class="form-control" name="name" value="${(obj.name)!}" data-check="must|max-len:100" type="text" />
                        </td>
                    </tr>
		        	<tr>
                        <td><label class="form-label">执行时间<b class="red">*</b></label></td>
                        <td>
                            <input class="form-control" name="exec_time" value="${(obj.exec_time)!}" data-check="must|max-len:100" type="text" />
                            <span class="form-tip alert alert-info">例如凌晨0点30分执行：“0 30 0 * * ? *”</span>
                        </td>
                    </tr>
                    <tr>
                        <td><label class="form-label">数据处理方式<b class="red">*</b></label></td>
                        <td>
                            <select class="form-select" name="type" >
                                <option value="">--请选择--</option>
                                <option value="1" <#if (obj.type)??&&obj.type==1>selected="selected"</#if>>覆盖</option>
                                <option value="2" <#if (obj.type)??&&obj.type==2>selected="selected"</#if>>追加</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><label class="form-label">开启状态<b class="red">*</b></label></td>
                        <td>
                            <select class="form-select" name="state" >
                                <option value="">--请选择--</option>
                                <option value="1" <#if (obj.state)??&&obj.state==1>selected="selected"</#if>>开启</option>
                                <option value="0" <#if (obj.state)??&&obj.state==0>selected="selected"</#if>>关闭</option>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><label class="form-label">数据来源<b class="red">*</b></label></td>
                        <td>
                            <select class="form-select" name="db_source" >
                                <option value="">--请选择--</option>
                                <#list dbs as db>
                                    <option value="${db.id}" <#if (obj.db_source)??&&obj.db_source==db.id>selected="selected"</#if> >${db.name}</option>
                                </#list>
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td><label class="form-label">数据目标<b class="red">*</b></label></td>
                        <td>
                            <select class="form-select" name="db_target" >
                                <option value="">--请选择--</option>
                                <#list dbs as db>
                                    <option value="${db.id}" <#if (obj.db_target)??&&obj.db_target==db.id>selected="selected"</#if> >${db.name}</option>
                                </#list>
                            </select>
                        </td>
                    </tr>
		            <tr>
		                <td><label class="form-label">&nbsp;</label></td>
		                <td>
		                    <input class="btn btn-success btn-large" type="button" onclick="_save()" value="提交">
		                    <input class="btn btn-danger btn-large" type="reset" value="重置">
		                    <input class="btn btn-primary btn-large" type="button" onclick="_back();" value="返回" >
		                </td>
		            </tr>
		        </table>
		    </form>
        </div>
<script type="text/javascript"> 
var prefix = "${contextPath}";
function _save() { 
	var url = '${contextPath}/jobInfo/modify' ;
	if($('#saveform').check()){
		var post = $('#saveform').serialize();
		if(!confirm("确定提交？")) return false;
		$.post(url,post,function(data){
			if(1==data.s){
				alert(data.d||"操作成功");
				parent.grid.refresh();
                _back();
			}else{
				alert(data.d||"操作失败");
			}
		},"json");
	}
}

function _back(){
    parent.layer.closeAll();
}
$(document).ready(function(){
	
	// 解决IE6下第二次打开弹窗时焦点丢失的问题
	$('#form :input:not(:hidden):not(:button):first').focus();
});
</script>
</body>
</html>